package com.itlaobing.service;

import java.sql.SQLException;

import com.itlaobing.dao.UserDao;
import com.itlaobing.exception.MyException;

import cn.itlaobing.model.UserModel;

public class UserService {
	private UserDao ud=new UserDao();
	public UserModel queryAll(String username,String userpwd)throws MyException
	{
		try {
			return ud.queryAll(username,userpwd);
		} catch (ClassNotFoundException e) {
			e.printStackTrace();
			throw new MyException(e.getMessage());
		} catch (SQLException e) {
			e.printStackTrace();
			throw new MyException(e.getMessage());
		}finally
		{
			try {
				ud.close();
			} catch (SQLException e) {
				e.printStackTrace();
				throw new MyException(e.getMessage());
			}
		}
	}
	public int updateTime(Integer id)throws MyException
	{
		try {
			return ud.updateTime(id);
		} catch (ClassNotFoundException e) {
			e.printStackTrace();
			throw new MyException(e.getMessage());
		} catch (SQLException e) {
			e.printStackTrace();
			throw new MyException(e.getMessage());
		}finally
		{
			try {
				ud.close();
			} catch (SQLException e) {
				e.printStackTrace();
				throw new MyException(e.getMessage());
			}
		}
	}
}
